/**
 * 
 */
package com.probiz.estore.order.service;

import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import com.probiz.estore.common.model.order.CheckoutSession;
import com.probiz.estore.common.model.order.OrderPayment;
import com.probiz.estore.common.model.order.OrderPick;
import com.probiz.estore.common.model.order.OrderShipment;
import com.probiz.estore.common.model.order.SalesOrder;
import com.probiz.estore.exception.GiftCertificateStateException;
import com.probiz.estore.exception.OrderProccessFlowException;
import com.probiz.estore.exception.OutOfStockException;
import com.probiz.estore.exception.ShopPointConsumptionException;
import com.probiz.estore.order.model.OrderCancelModel;
import com.probiz.estore.order.model.OrderCompleteModel;

/**
 * 订单流程处理接口
 * 
 */
public interface OrderProcessFlowManager {
	
	
	/**
	 * 下订单（前后台适用）
	 * @param checkoutSession
	 * @return
	 */
	public SalesOrder createSalesOrder(CheckoutSession checkoutSession) throws OutOfStockException, GiftCertificateStateException, ShopPointConsumptionException;
	/**
	 * 确认订单
	 * @param salesOrder
	 */
	public void doConfirmOrder(SalesOrder salesOrder) throws OrderProccessFlowException;
	
	/**
	 * 订单收款
	 * @param salesOrder
	 * @param orderPayment
	 */
	public void doPayOrder(SalesOrder salesOrder,OrderPayment orderPayment) throws OrderProccessFlowException;
	
	/**
	 * 订单退款
	 * @param salesOrder
	 * @param orderPayment
	 */
	public void doRefundOrder(SalesOrder salesOrder,OrderPayment orderPayment) throws OrderProccessFlowException;
	
	/**
	 * 订单发货
	 * @param salesOrder
	 * @param orderShipment
	 */
	public void doShipOrder(SalesOrder salesOrder,OrderShipment orderShipment) throws OrderProccessFlowException;
	
	/**
	 * 订单退货
	 * @param salesOrder
	 * @param orderShipment
	 */
	public void doReturnOrder(SalesOrder salesOrder,OrderShipment orderShipment) throws OrderProccessFlowException;
	/**
	 * 订单完成
	 * @param salesOrder
	 * @param completeModel
	 * @throws OrderProccessFlowException
	 */
	public void doCompleteOrder(SalesOrder salesOrder,OrderCompleteModel completeModel) throws OrderProccessFlowException;
	/**
	 * 管理员作废订单
	 * @param salesOrder
	 * @param cancelModel
	 * @throws OrderProccessFlowException
	 */
	public void doCancelOrderByAdmin(SalesOrder salesOrder, OrderCancelModel cancelModel) throws OrderProccessFlowException;
	/**
	 * 客户作废订单
	 * @param salesOrder
	 * @throws OrderProccessFlowException
	 */
	public void doCancelOrderByCustomer(SalesOrder salesOrder) throws OrderProccessFlowException;
	/**
	 * 超时未支付取消订单
	 * @param salesOrder
	 * @throws OrderProccessFlowException
	 */
	public void doCancelOrder4NotPaid(SalesOrder salesOrder) throws OrderProccessFlowException;
	/**
	 * 生成备货单
	 * @param orderNos
	 * @throws OrderProccessFlowException
	 */
	public OrderPick doPickOrder(Set<String> orderNos) throws OrderProccessFlowException;
	
	/**
	 * 后台下单构造订单结账对象。注意，此时CheckoutSession不再放在session中。
	 * @param request
	 * @return
	 */
	public CheckoutSession buildCheckoutSession4Admin(HttpServletRequest request);
	
	
	/**
	 * 编辑订单保存
	 * @param salesOrder
	 * @param checkoutSession
	 * @throws OrderProccessFlowException
	 */
	public void doEditOrder(SalesOrder salesOrder,CheckoutSession checkoutSession) throws OrderProccessFlowException;
	
	
	

	
}
